# coding: utf-8

from flask_wtf import FlaskForm
from wtforms import StringField, SubmitField, DateField, PasswordField, SelectField
from wtforms.validators import DataRequired


class UserAddForm(FlaskForm):
    username = StringField('用户名', validators=[DataRequired()])
    password = PasswordField('密码', validators=[DataRequired()])
    age = StringField('年龄', validators=[DataRequired()])
    birthday = DateField('生日', validators=[DataRequired()])
    is_active = SelectField('是否激活',
                            choices=[('1', '是'), ('0', '否')], 
                            coerce=int,
                            validators=[DataRequired(message="是否激活为必填项")])
    submit = SubmitField('添加')


class UserEditForm(UserAddForm):
    submit = SubmitField('编辑')
